package cn.xopencode.recordservice.dal.mysql.mapper.lowroom;

import cn.xopencode.recordservice.dal.mysql.dataobject.lowroom.LowRoomRecordEmpRelDO;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface LowRoomRecordRelMapper extends BaseMapper<LowRoomRecordEmpRelDO> {

    /**
     * 批量插入。因为 MyBaits Plus 的批量插入是基于 Service 实现，所以只好写 XML
     *
     * @param lowRoomRecordRels 数组
     */

    int insertList(@Param("lowRoomRecordRels") List<LowRoomRecordEmpRelDO> lowRoomRecordRels);

    default List<LowRoomRecordEmpRelDO> selectListByLowRoomRecordId(String recordId){
        return selectList(new QueryWrapper<LowRoomRecordEmpRelDO>().eq("record_id", recordId));
    }

    default int deleteByLowroomId(String recordId){
        return delete(new QueryWrapper<LowRoomRecordEmpRelDO>().eq("record_id", recordId));
    }
}
